package com.working.content.init

import android.content.Context
import androidx.navigation.fragment.fragment
import androidx.startup.Initializer
import com.alibaba.android.arouter.launcher.ARouter
import com.working.libbase.initializer.AppInitializer
import com.working.libbase.initializer.ApplicationProvider
import com.working.content.R
import com.working.content.ContentFragment
import com.working.content.di.contentModule
import org.koin.core.context.loadKoinModules

class ModuleInitializer : Initializer<Unit> {
    override fun create(context: Context) {
        val applicationProvider = ARouter.getInstance().navigation(ApplicationProvider::class.java)
        applicationProvider.addDestination {
            this.fragment<ContentFragment>(R.id.tab_content)
        }
        applicationProvider.addMenu {
            add(0, R.id.tab_content, 1, "内容").setIcon(R.drawable.content_ic_action_content)
        }
        loadKoinModules(contentModule)
    }

    override fun dependencies(): MutableList<Class<out Initializer<*>>> =
        mutableListOf(AppInitializer::class.java)
}